<template>
	<view>
		123
		<canvas style="width: 300px; height: 150px" id="firstCanvas" type="2d"></canvas>
	</view>
</template>

<script>
export default {
	mounted() {
		uni.createSelectorQuery()
		    .select('#firstCanvas')
		    .node(({ node: canvas }) => {
		        const ctx = canvas.getContext('2d');
				ctx.clearRect(0, 0, canvas.width, canvas.height)
				 ball.x += speed;
				  ctx.beginPath();
				  ctx.arc(ball.x, ball.y, 20, 0, Math.PI * 2);
				  ctx.fill();
				  requestAnimationFrame(animate);
		    })
		    .exec()
	}
};
</script>
